
from threadpool import ThreadPool,makeRequests;
import threading
#   python 线程池

# custom 自定义线程池

pool = ThreadPool(10);


def callback():
    print("callback")
    pass;

def some_callable():
    print("some_callable")
    pass;


def myIpPool(ipPrefix):
    List = []
    for i in range(1, 255):
        List.append("%s.%d" % (ipPrefix, i))
    return List
# 串行运行telnet登录
L = myIpPool("200.200.200")
def myTelnet(L):
    print("myTelnet",L)
    print(threading.current_thread().getName())


def myTelnet1(L):
    print("myTelnet1",L)
    print(threading.current_thread().getName())

pool = ThreadPool(10)
requests = makeRequests(myTelnet, (1,2))


#[pool.putRequest(req) for req in requests]
for req in requests:
    pool.putRequest(req);


pool.wait();

print("2")




